<!DOCTYPE html>
<html lang="zh_CN">
<head>
    <#include "../common/header.ftl" />
</head>

<script>
    $(function () {
        //发布或拒绝按钮
        $(".changeStateBtn").click(function () {
            var state = $(this).data("state");
            var id = $(this).data("tid");
            $.get("/travel/changeState.do",{id:id,state:state},function (data) {
                reload();
            })
        });
        //查看文章按钮
        $(".contentBtn").click(function () {
            var id = $(this).data("tid");
            $.get("/travelContent/selectContent.do",{id:id},function (data) {
                $(".modal-body").html(data.content);
                $("#travelContentModel").modal("show");
            })
        });
    })
</script>
<body>
<!-- 模态框（Modal） -->
<div class="modal fade" id="travelContentModel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title" id="myModalLabel">文章内容</h4>
            </div>
            <#--游记内容-->
            <div class="modal-body">
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div>
<#-- 设置模态框内图片的样式 -->
<style>
    #travelContentModel img{
        width: 100%;
    }
</style>

<div class="container " style="margin-top: 20px">
    <#include "../common/top.ftl" />
    <div class="row">
        <div class="col-sm-3">
            <#assign menu="travel"/>
            <#include "../common/menu.ftl" />
        </div>
        <div class="col-sm-9">
            <div class="row">
                <div class="col-sm-12">
                    <h1 class="page-head-line">待审核游记列表</h1>
                </div>
            </div>
            <!--高级查询--->
            <form class="form-inline" id="searchForm" action="/travel/list.do" method="post">
                <input type="hidden" name="currentPage" id="currentPage" value="1">
                <select class="form-control" name="state">
                    <option value="1">待审核</option>
                    <option value="-1">拒绝</option>
                </select>
                <script>
                    <#-- 回显状态 -->
                    $("#searchForm select").val(${qo.state});

                </script>
                <input type="hidden" name="currentPage" id="currentPage" value="1">
                <button id="btn_query" class="btn btn-default" type="submit">
                    <span class="glyphicon glyphicon-search"></span> 查询
                </button>
            </form>

            <table class="table table-striped table-hover" >
                <tr>
                    <th>编号</th>
                    <th>标题</th>
                    <th>封面</th>
                    <th>地点</th>
                    <th>作者</th>
                    <th>状态</th>
                    <th></th>
                </tr>


                <#list pageInfo.list as entity>
                    <tr>
                       <td>${entity_index + 1}</td>
                       <td>${entity.title}</td>
                       <td><img src="${entity.coverUrl}" width="30px"> </td>
                       <td>${entity.place.name}</td>
                       <td>${entity.author.nickName}</td>
                       <td>${entity.stateName}</td>
                        <td>
                            <a class="btn btn-info btn-xs btn-input changeStateBtn" data-state="2" data-tid="${entity.id}">
                                <span class="glyphicon glyphicon-ok"></span>发布
                            </a>
                            <a class="btn btn-info btn-xs btn-input changeStateBtn" data-state="-1" data-tid="${entity.id}">
                                <span class="glyphicon glyphicon-ban-circle"></span>拒绝
                            </a>
                            <a class="btn btn-info btn-xs btn-input contentBtn"  data-tid="${entity.id}">
                                <span class="glyphicon glyphicon-pencil"></span>查看文章
                            </a>
                        </td>
                    </tr>
                </#list>
            </table>
            <#include "../common/page.ftl" />
        </div>
    </div>
</div>

<script>

</script>
</body>
</html>